package com.ymu.beyond.sshDay1;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author GoBeyond
 * @Date 2016年11月27日
 */
public class LoginAction extends ActionSupport {
	private static final long serialVersionUID = 1L;
	private String username;
	private String password;

	@Override
	public String execute() throws Exception {
		if ("zhangsan".equals(username) && "123456".equals(password)) {
			// 用session存放名字的时候可以采用：
			ServletActionContext.getRequest().getSession().setAttribute("username", username);
			System.out.println(1);
			return SUCCESS;
		} else {
			System.out.println(0);
			return "fail";
		}

	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
